# -*- coding: utf-8 -*-
"""
@Env 
@Time 2024/9/3 上午10:14
@Author yzpang
@Function: api入口
"""
import multiprocessing
import os
import uvicorn
from modelserver.api.app import create_app


def main():
    app = create_app()
    api_host = os.environ.get('API_HOST', '0.0.0.0')
    api_port = int(os.environ.get('API_PORT', 8000))
    print('\nVisit http://localhost:{}/docs for API document'.format(api_port))
    uvicorn.run(app, host=api_host, port=api_port)


if __name__ == '__main__':
    multiprocessing.set_start_method('spawn', force=True)
    main()
